1bc03f14fSopenharmony_ci/*
2bc03f14fSopenharmony_ci * Copyright (C) 2022-2023 Huawei Device Co., Ltd.
3bc03f14fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the 'License');
4bc03f14fSopenharmony_ci * you may not use this file except in compliance with the License.
5bc03f14fSopenharmony_ci * You may obtain a copy of the License at
6bc03f14fSopenharmony_ci *
7bc03f14fSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8bc03f14fSopenharmony_ci *
9bc03f14fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10bc03f14fSopenharmony_ci * distributed under the License is distributed on an 'AS IS' BASIS,
11bc03f14fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12bc03f14fSopenharmony_ci * See the License for the specific language governing permissions and
13bc03f14fSopenharmony_ci * limitations under the License.
14bc03f14fSopenharmony_ci */
15bc03f14fSopenharmony_ci// @ts-nocheck
16bc03f14fSopenharmony_ciimport { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
17bc03f14fSopenharmony_ciimport pasteboard from '@ohos.pasteboard';
18bc03f14fSopenharmony_ciimport image from '@ohos.multimedia.image';
19bc03f14fSopenharmony_ci
20bc03f14fSopenharmony_cidescribe('PasteBoardJSTest', function () {
21bc03f14fSopenharmony_ci  beforeAll(async function () {
22bc03f14fSopenharmony_ci    console.info('beforeAll');
23bc03f14fSopenharmony_ci  });
24bc03f14fSopenharmony_ci
25bc03f14fSopenharmony_ci  afterAll(async function () {
26bc03f14fSopenharmony_ci    console.info('afterAll');
27bc03f14fSopenharmony_ci  });
28bc03f14fSopenharmony_ci
29bc03f14fSopenharmony_ci  /**
30bc03f14fSopenharmony_ci   * @tc.name      pasteboard_callback_test1
31bc03f14fSopenharmony_ci   * @tc.desc      createPlainTextData test
32bc03f14fSopenharmony_ci   * @tc.type      Function
33bc03f14fSopenharmony_ci   * @tc.require   AR000HEECD
34bc03f14fSopenharmony_ci   */
35bc03f14fSopenharmony_ci  it('pasteboard_callback_test1', 0, async function (done) {
36bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
37bc03f14fSopenharmony_ci    systemPasteboard.clear((err, data) => {
38bc03f14fSopenharmony_ci      if (err) {
39bc03f14fSopenharmony_ci        console.error('f_test1: systemPasteboard.clear callback error:' + err);
40bc03f14fSopenharmony_ci        return;
41bc03f14fSopenharmony_ci      }
42bc03f14fSopenharmony_ci      const textData1 = 'Hello World!';
43bc03f14fSopenharmony_ci      const pasteData = pasteboard.createPlainTextData(textData1);
44bc03f14fSopenharmony_ci      systemPasteboard.setPasteData(pasteData, (err, data) => {
45bc03f14fSopenharmony_ci        if (err) {
46bc03f14fSopenharmony_ci          console.error('f_test1: systemPasteboard.setPasteData callback error:' + err);
47bc03f14fSopenharmony_ci          return;
48bc03f14fSopenharmony_ci        }
49bc03f14fSopenharmony_ci        systemPasteboard.hasPasteData((err, data) => {
50bc03f14fSopenharmony_ci          if (err) {
51bc03f14fSopenharmony_ci            console.error('f_test1: systemPasteboard.hasPasteData callback error:' + err);
52bc03f14fSopenharmony_ci            return;
53bc03f14fSopenharmony_ci          }
54bc03f14fSopenharmony_ci          expect(data).assertEqual(true);
55bc03f14fSopenharmony_ci          systemPasteboard.getPasteData((err, data) => {
56bc03f14fSopenharmony_ci            if (err) {
57bc03f14fSopenharmony_ci              console.error('f_test1: systemPasteboard.getPasteData callback error:' + err);
58bc03f14fSopenharmony_ci              return;
59bc03f14fSopenharmony_ci            }
60bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(1);
61bc03f14fSopenharmony_ci            const primaryText1 = data.getPrimaryText();
62bc03f14fSopenharmony_ci            expect(primaryText1).assertEqual(textData1);
63bc03f14fSopenharmony_ci            expect(pasteboard.MAX_RECORD_NUM).assertEqual(512);
64bc03f14fSopenharmony_ci            expect(data.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN)).assertEqual(true);
65bc03f14fSopenharmony_ci            expect(data.getPrimaryMimeType()).assertEqual(pasteboard.MIMETYPE_TEXT_PLAIN);
66bc03f14fSopenharmony_ci            done();
67bc03f14fSopenharmony_ci          });
68bc03f14fSopenharmony_ci        });
69bc03f14fSopenharmony_ci      });
70bc03f14fSopenharmony_ci    });
71bc03f14fSopenharmony_ci  });
72bc03f14fSopenharmony_ci
73bc03f14fSopenharmony_ci  /**
74bc03f14fSopenharmony_ci   * @tc.name      pasteboard_callback_test2
75bc03f14fSopenharmony_ci   * @tc.desc      createHtmlData test
76bc03f14fSopenharmony_ci   * @tc.type      Function
77bc03f14fSopenharmony_ci   * @tc.require   AR000HEECD
78bc03f14fSopenharmony_ci   */
79bc03f14fSopenharmony_ci  it('pasteboard_callback_test2', 0, async function (done) {
80bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
81bc03f14fSopenharmony_ci    systemPasteboard.clear((err, data) => {
82bc03f14fSopenharmony_ci      if (err) {
83bc03f14fSopenharmony_ci        console.error('f_test2: systemPasteboard.clear callback error:' + err);
84bc03f14fSopenharmony_ci        return;
85bc03f14fSopenharmony_ci      }
86bc03f14fSopenharmony_ci      const htmlText2 = '<html><head></head><body>Hello World!</body></html>';
87bc03f14fSopenharmony_ci      const pasteData = pasteboard.createHtmlData(htmlText2);
88bc03f14fSopenharmony_ci      systemPasteboard.setPasteData(pasteData, (err, data) => {
89bc03f14fSopenharmony_ci        if (err) {
90bc03f14fSopenharmony_ci          console.error('f_test2: systemPasteboard.setPasteData callback error:' + err);
91bc03f14fSopenharmony_ci          return;
92bc03f14fSopenharmony_ci        }
93bc03f14fSopenharmony_ci        systemPasteboard.hasPasteData((err, data) => {
94bc03f14fSopenharmony_ci          if (err) {
95bc03f14fSopenharmony_ci            console.error('f_test2: systemPasteboard.hasPasteData callback error:' + err);
96bc03f14fSopenharmony_ci            return;
97bc03f14fSopenharmony_ci          }
98bc03f14fSopenharmony_ci          expect(data).assertEqual(true);
99bc03f14fSopenharmony_ci          systemPasteboard.getPasteData((err, data) => {
100bc03f14fSopenharmony_ci            if (err) {
101bc03f14fSopenharmony_ci              console.error('f_test2: systemPasteboard.getPasteData callback error:' + err);
102bc03f14fSopenharmony_ci              return;
103bc03f14fSopenharmony_ci            }
104bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(1);
105bc03f14fSopenharmony_ci            const PrimaryHtml2 = data.getPrimaryHtml();
106bc03f14fSopenharmony_ci            console.info('f_test2: PrimaryHtml = ' + PrimaryHtml2);
107bc03f14fSopenharmony_ci            expect(PrimaryHtml2).assertEqual(htmlText2);
108bc03f14fSopenharmony_ci            expect(data.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML)).assertEqual(true);
109bc03f14fSopenharmony_ci            expect(data.getPrimaryMimeType()).assertEqual(pasteboard.MIMETYPE_TEXT_HTML);
110bc03f14fSopenharmony_ci            done();
111bc03f14fSopenharmony_ci          });
112bc03f14fSopenharmony_ci        });
113bc03f14fSopenharmony_ci      });
114bc03f14fSopenharmony_ci    });
115bc03f14fSopenharmony_ci  });
116bc03f14fSopenharmony_ci
117bc03f14fSopenharmony_ci  /**
118bc03f14fSopenharmony_ci   * @tc.name      pasteboard_callback_test3
119bc03f14fSopenharmony_ci   * @tc.desc      测试异步callback调用+createHtmlData,htmlText = ''.
120bc03f14fSopenharmony_ci   * @tc.type      Function
121bc03f14fSopenharmony_ci   * @tc.require   AR000HEECD
122bc03f14fSopenharmony_ci   */
123bc03f14fSopenharmony_ci  it('pasteboard_callback_test3', 0, async function (done) {
124bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
125bc03f14fSopenharmony_ci    systemPasteboard.clear((err, data) => {
126bc03f14fSopenharmony_ci      if (err) {
127bc03f14fSopenharmony_ci        console.error('f_test3: systemPasteboard.clear callback error:' + err);
128bc03f14fSopenharmony_ci        return;
129bc03f14fSopenharmony_ci      }
130bc03f14fSopenharmony_ci      const htmlText3 = '';
131bc03f14fSopenharmony_ci      const pasteData = pasteboard.createHtmlData(htmlText3);
132bc03f14fSopenharmony_ci      systemPasteboard.setPasteData(pasteData, (err, data) => {
133bc03f14fSopenharmony_ci        if (err) {
134bc03f14fSopenharmony_ci          console.error('f_test3: systemPasteboard.setPasteData callback error:' + err);
135bc03f14fSopenharmony_ci          return;
136bc03f14fSopenharmony_ci        }
137bc03f14fSopenharmony_ci        systemPasteboard.hasPasteData((err, data) => {
138bc03f14fSopenharmony_ci          if (err) {
139bc03f14fSopenharmony_ci            console.error('f_test3: systemPasteboard.hasPasteData callback error:' + err);
140bc03f14fSopenharmony_ci            return;
141bc03f14fSopenharmony_ci          }
142bc03f14fSopenharmony_ci          expect(data).assertEqual(true);
143bc03f14fSopenharmony_ci          systemPasteboard.getPasteData((err, data) => {
144bc03f14fSopenharmony_ci            if (err) {
145bc03f14fSopenharmony_ci              console.error('f_test3: systemPasteboard.getPasteData callback error:' + err);
146bc03f14fSopenharmony_ci              return;
147bc03f14fSopenharmony_ci            }
148bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(1);
149bc03f14fSopenharmony_ci            const PrimaryHtml3 = data.getPrimaryHtml();
150bc03f14fSopenharmony_ci            console.info('f_test3: PrimaryHtml = ' + PrimaryHtml3);
151bc03f14fSopenharmony_ci            expect(PrimaryHtml3).assertEqual(htmlText3);
152bc03f14fSopenharmony_ci            expect(data.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML)).assertEqual(true);
153bc03f14fSopenharmony_ci            expect(data.getPrimaryMimeType()).assertEqual(pasteboard.MIMETYPE_TEXT_HTML);
154bc03f14fSopenharmony_ci            done();
155bc03f14fSopenharmony_ci          });
156bc03f14fSopenharmony_ci        });
157bc03f14fSopenharmony_ci      });
158bc03f14fSopenharmony_ci    });
159bc03f14fSopenharmony_ci  });
160bc03f14fSopenharmony_ci
161bc03f14fSopenharmony_ci  /**
162bc03f14fSopenharmony_ci   * @tc.name      pasteboard_callback_test4
163bc03f14fSopenharmony_ci   * @tc.desc      createUriData test
164bc03f14fSopenharmony_ci   * @tc.type      Function
165bc03f14fSopenharmony_ci   * @tc.require   AR000HEECD
166bc03f14fSopenharmony_ci   */
167bc03f14fSopenharmony_ci  it('pasteboard_callback_test4', 0, async function (done) {
168bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
169bc03f14fSopenharmony_ci    systemPasteboard.clear((err, data) => {
170bc03f14fSopenharmony_ci      if (err) {
171bc03f14fSopenharmony_ci        console.error('f_test4: systemPasteboard.clear callback error:' + err);
172bc03f14fSopenharmony_ci        return;
173bc03f14fSopenharmony_ci      }
174bc03f14fSopenharmony_ci      const uriText4 = '';
175bc03f14fSopenharmony_ci      const pasteData = pasteboard.createUriData(uriText4);
176bc03f14fSopenharmony_ci      systemPasteboard.setPasteData(pasteData, (err, data) => {
177bc03f14fSopenharmony_ci        if (err) {
178bc03f14fSopenharmony_ci          console.error('f_test4: systemPasteboard.setPasteData callback error:' + err);
179bc03f14fSopenharmony_ci          return;
180bc03f14fSopenharmony_ci        }
181bc03f14fSopenharmony_ci        systemPasteboard.hasPasteData((err, data) => {
182bc03f14fSopenharmony_ci          if (err) {
183bc03f14fSopenharmony_ci            console.error('f_test4: systemPasteboard.hasPasteData callback error:' + err);
184bc03f14fSopenharmony_ci            return;
185bc03f14fSopenharmony_ci          }
186bc03f14fSopenharmony_ci          expect(data).assertEqual(true);
187bc03f14fSopenharmony_ci          systemPasteboard.getPasteData((err, data) => {
188bc03f14fSopenharmony_ci            if (err) {
189bc03f14fSopenharmony_ci              console.error('f_test4: systemPasteboard.getPasteData callback error:' + err);
190bc03f14fSopenharmony_ci              return;
191bc03f14fSopenharmony_ci            }
192bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(1);
193bc03f14fSopenharmony_ci            const PrimaryUri4 = data.getPrimaryUri();
194bc03f14fSopenharmony_ci            console.info('f_test4: PrimaryUri = ' + PrimaryUri4);
195bc03f14fSopenharmony_ci            expect(PrimaryUri4).assertEqual(uriText4);
196bc03f14fSopenharmony_ci            expect(data.hasMimeType(pasteboard.MIMETYPE_TEXT_URI)).assertEqual(true);
197bc03f14fSopenharmony_ci            expect(data.getPrimaryMimeType()).assertEqual(pasteboard.MIMETYPE_TEXT_URI);
198bc03f14fSopenharmony_ci            done();
199bc03f14fSopenharmony_ci          });
200bc03f14fSopenharmony_ci        });
201bc03f14fSopenharmony_ci      });
202bc03f14fSopenharmony_ci    });
203bc03f14fSopenharmony_ci  });
204bc03f14fSopenharmony_ci
205bc03f14fSopenharmony_ci  /**
206bc03f14fSopenharmony_ci   * @tc.name      pasteboard_callback_test5
207bc03f14fSopenharmony_ci   * @tc.desc      createWantData test
208bc03f14fSopenharmony_ci   * @tc.type      Function
209bc03f14fSopenharmony_ci   * @tc.require   AR000HEECD
210bc03f14fSopenharmony_ci   */
211bc03f14fSopenharmony_ci  it('pasteboard_callback_test5', 0, async function (done) {
212bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
213bc03f14fSopenharmony_ci    systemPasteboard.clear((err, data) => {
214bc03f14fSopenharmony_ci      if (err) {
215bc03f14fSopenharmony_ci        console.error('f_test5: systemPasteboard.clear callback error:' + err);
216bc03f14fSopenharmony_ci        return;
217bc03f14fSopenharmony_ci      }
218bc03f14fSopenharmony_ci      const want5 = {
219bc03f14fSopenharmony_ci        bundleName: 'com.example.myapplication8',
220bc03f14fSopenharmony_ci        abilityName: 'com.example.myapplication8.MainAbility',
221bc03f14fSopenharmony_ci      };
222bc03f14fSopenharmony_ci      const pasteData = pasteboard.createWantData(want5);
223bc03f14fSopenharmony_ci      systemPasteboard.setPasteData(pasteData, (err, data) => {
224bc03f14fSopenharmony_ci        if (err) {
225bc03f14fSopenharmony_ci          console.error('f_test5: systemPasteboard.setPasteData callback error:' + err);
226bc03f14fSopenharmony_ci          return;
227bc03f14fSopenharmony_ci        }
228bc03f14fSopenharmony_ci        systemPasteboard.hasPasteData((err, data) => {
229bc03f14fSopenharmony_ci          if (err) {
230bc03f14fSopenharmony_ci            console.error('f_test5: systemPasteboard.hasPasteData callback error:' + err);
231bc03f14fSopenharmony_ci            return;
232bc03f14fSopenharmony_ci          }
233bc03f14fSopenharmony_ci          expect(data).assertEqual(true);
234bc03f14fSopenharmony_ci          systemPasteboard.getPasteData((err, data) => {
235bc03f14fSopenharmony_ci            if (err) {
236bc03f14fSopenharmony_ci              console.error('f_test5: systemPasteboard.getPasteData callback error:' + err);
237bc03f14fSopenharmony_ci              return;
238bc03f14fSopenharmony_ci            }
239bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(1);
240bc03f14fSopenharmony_ci            const PrimaryWant5 = data.getPrimaryWant();
241bc03f14fSopenharmony_ci            expect(PrimaryWant5.bundleName).assertEqual(want5.bundleName);
242bc03f14fSopenharmony_ci            expect(PrimaryWant5.abilityName).assertEqual(want5.abilityName);
243bc03f14fSopenharmony_ci            expect(data.hasMimeType(pasteboard.MIMETYPE_TEXT_WANT)).assertEqual(true);
244bc03f14fSopenharmony_ci            expect(data.getPrimaryMimeType()).assertEqual(pasteboard.MIMETYPE_TEXT_WANT);
245bc03f14fSopenharmony_ci            done();
246bc03f14fSopenharmony_ci          });
247bc03f14fSopenharmony_ci        });
248bc03f14fSopenharmony_ci      });
249bc03f14fSopenharmony_ci    });
250bc03f14fSopenharmony_ci  });
251bc03f14fSopenharmony_ci
252bc03f14fSopenharmony_ci  /**
253bc03f14fSopenharmony_ci   * @tc.name      pasteboard_callback_test6
254bc03f14fSopenharmony_ci   * @tc.desc      addTextRecord test
255bc03f14fSopenharmony_ci   * @tc.type      Function
256bc03f14fSopenharmony_ci   * @tc.require   AR000HEECD
257bc03f14fSopenharmony_ci   */
258bc03f14fSopenharmony_ci  it('pasteboard_callback_test6', 0, async function (done) {
259bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
260bc03f14fSopenharmony_ci    systemPasteboard.clear((err, data) => {
261bc03f14fSopenharmony_ci      if (err) {
262bc03f14fSopenharmony_ci        console.error('f_test6: systemPasteboard.clear callback error:' + err);
263bc03f14fSopenharmony_ci        return;
264bc03f14fSopenharmony_ci      }
265bc03f14fSopenharmony_ci      const textData6 = 'Hello World!';
266bc03f14fSopenharmony_ci      const pasteData = pasteboard.createPlainTextData(textData6);
267bc03f14fSopenharmony_ci      const textData62 = 'Hello World1';
268bc03f14fSopenharmony_ci      pasteData.addTextRecord(textData62);
269bc03f14fSopenharmony_ci      systemPasteboard.setPasteData(pasteData, (err, data) => {
270bc03f14fSopenharmony_ci        if (err) {
271bc03f14fSopenharmony_ci          console.error('f_test6: systemPasteboard.setPasteData callback error:' + err);
272bc03f14fSopenharmony_ci          return;
273bc03f14fSopenharmony_ci        }
274bc03f14fSopenharmony_ci        systemPasteboard.hasPasteData((err, data) => {
275bc03f14fSopenharmony_ci          if (err) {
276bc03f14fSopenharmony_ci            console.error('f_test6: systemPasteboard.hasPasteData callback error:' + err);
277bc03f14fSopenharmony_ci            return;
278bc03f14fSopenharmony_ci          }
279bc03f14fSopenharmony_ci          expect(data).assertEqual(true);
280bc03f14fSopenharmony_ci          systemPasteboard.getPasteData((err, data) => {
281bc03f14fSopenharmony_ci            if (err) {
282bc03f14fSopenharmony_ci              console.error('f_test6: systemPasteboard.getPasteData callback error:' + err);
283bc03f14fSopenharmony_ci              return;
284bc03f14fSopenharmony_ci            }
285bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(2);
286bc03f14fSopenharmony_ci            const PrimaryText6 = data.getPrimaryText();
287bc03f14fSopenharmony_ci            expect(PrimaryText6).assertEqual(textData62);
288bc03f14fSopenharmony_ci            expect(data.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN)).assertEqual(true);
289bc03f14fSopenharmony_ci            expect(data.getPrimaryMimeType()).assertEqual(pasteboard.MIMETYPE_TEXT_PLAIN);
290bc03f14fSopenharmony_ci            done();
291bc03f14fSopenharmony_ci          });
292bc03f14fSopenharmony_ci        });
293bc03f14fSopenharmony_ci      });
294bc03f14fSopenharmony_ci    });
295bc03f14fSopenharmony_ci  });
296bc03f14fSopenharmony_ci
297bc03f14fSopenharmony_ci  /**
298bc03f14fSopenharmony_ci   * @tc.name      pasteboard_callback_test7
299bc03f14fSopenharmony_ci   * @tc.desc      addTextRecord test
300bc03f14fSopenharmony_ci   * @tc.type      Function
301bc03f14fSopenharmony_ci   * @tc.require   AR000HEECD
302bc03f14fSopenharmony_ci   */
303bc03f14fSopenharmony_ci  it('pasteboard_callback_test7', 0, async function (done) {
304bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
305bc03f14fSopenharmony_ci    systemPasteboard.clear((err, data) => {
306bc03f14fSopenharmony_ci      if (err) {
307bc03f14fSopenharmony_ci        console.error('f_test7: systemPasteboard.clear callback error:' + err);
308bc03f14fSopenharmony_ci        return;
309bc03f14fSopenharmony_ci      }
310bc03f14fSopenharmony_ci      const textData71 = 'Hello World!';
311bc03f14fSopenharmony_ci      const pasteData = pasteboard.createPlainTextData(textData71);
312bc03f14fSopenharmony_ci      let textData7 = '';
313bc03f14fSopenharmony_ci      for (let i = 1; i < 15; i++) {
314bc03f14fSopenharmony_ci        textData7 = 'Hello World';
315bc03f14fSopenharmony_ci        textData7 = textData7 + i;
316bc03f14fSopenharmony_ci        pasteData.addTextRecord(textData7);
317bc03f14fSopenharmony_ci      }
318bc03f14fSopenharmony_ci      systemPasteboard.setPasteData(pasteData, (err, data) => {
319bc03f14fSopenharmony_ci        if (err) {
320bc03f14fSopenharmony_ci          console.error('f_test7: systemPasteboard.setPasteData callback error:' + err);
321bc03f14fSopenharmony_ci          return;
322bc03f14fSopenharmony_ci        }
323bc03f14fSopenharmony_ci        systemPasteboard.hasPasteData((err, data) => {
324bc03f14fSopenharmony_ci          if (err) {
325bc03f14fSopenharmony_ci            console.error('f_test7: systemPasteboard.hasPasteData callback error:' + err);
326bc03f14fSopenharmony_ci            return;
327bc03f14fSopenharmony_ci          }
328bc03f14fSopenharmony_ci          expect(data).assertEqual(true);
329bc03f14fSopenharmony_ci          systemPasteboard.getPasteData((err, data) => {
330bc03f14fSopenharmony_ci            if (err) {
331bc03f14fSopenharmony_ci              console.error('f_test7: systemPasteboard.getPasteData callback error:' + err);
332bc03f14fSopenharmony_ci              return;
333bc03f14fSopenharmony_ci            }
334bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(15);
335bc03f14fSopenharmony_ci            const PrimaryText7 = data.getPrimaryText();
336bc03f14fSopenharmony_ci            expect(data.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN)).assertEqual(true);
337bc03f14fSopenharmony_ci            expect(data.getPrimaryMimeType()).assertEqual(pasteboard.MIMETYPE_TEXT_PLAIN);
338bc03f14fSopenharmony_ci            expect(PrimaryText7).assertEqual('Hello World14');
339bc03f14fSopenharmony_ci            done();
340bc03f14fSopenharmony_ci          });
341bc03f14fSopenharmony_ci        });
342bc03f14fSopenharmony_ci      });
343bc03f14fSopenharmony_ci    });
344bc03f14fSopenharmony_ci  });
345bc03f14fSopenharmony_ci
346bc03f14fSopenharmony_ci  /**
347bc03f14fSopenharmony_ci   * @tc.name      pasteboard_callback_test8
348bc03f14fSopenharmony_ci   * @tc.desc      addHtmlRecord+addUriRecord+addWantRecord
349bc03f14fSopenharmony_ci   * @tc.type      Function
350bc03f14fSopenharmony_ci   * @tc.require   AR000HEECD
351bc03f14fSopenharmony_ci   */
352bc03f14fSopenharmony_ci  it('pasteboard_callback_test8', 0, async function (done) {
353bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
354bc03f14fSopenharmony_ci    systemPasteboard.clear((err, data) => {
355bc03f14fSopenharmony_ci      if (err) {
356bc03f14fSopenharmony_ci        console.error('f_test8: systemPasteboard.clear callback error:' + err);
357bc03f14fSopenharmony_ci        return;
358bc03f14fSopenharmony_ci      }
359bc03f14fSopenharmony_ci      const textData8 = 'Hello World!';
360bc03f14fSopenharmony_ci      const pasteData = pasteboard.createPlainTextData(textData8);
361bc03f14fSopenharmony_ci      const htmlText8 = '<html><head></head><body>Hello World!</body></html>';
362bc03f14fSopenharmony_ci      pasteData.addHtmlRecord(htmlText8);
363bc03f14fSopenharmony_ci      const uriText8 = '';
364bc03f14fSopenharmony_ci      pasteData.addUriRecord(uriText8);
365bc03f14fSopenharmony_ci      const want8 = {
366bc03f14fSopenharmony_ci        bundleName: 'com.example.myapplication8',
367bc03f14fSopenharmony_ci        abilityName: 'com.example.myapplication8.MainAbility',
368bc03f14fSopenharmony_ci      };
369bc03f14fSopenharmony_ci      pasteData.addWantRecord(want8);
370bc03f14fSopenharmony_ci      systemPasteboard.setPasteData(pasteData, (err, data) => {
371bc03f14fSopenharmony_ci        if (err) {
372bc03f14fSopenharmony_ci          console.error('f_test8: systemPasteboard.setPasteData callback error:' + err);
373bc03f14fSopenharmony_ci          return;
374bc03f14fSopenharmony_ci        }
375bc03f14fSopenharmony_ci        systemPasteboard.hasPasteData((err, data) => {
376bc03f14fSopenharmony_ci          if (err) {
377bc03f14fSopenharmony_ci            console.error('f_test8: systemPasteboard.hasPasteData callback error:' + err);
378bc03f14fSopenharmony_ci            return;
379bc03f14fSopenharmony_ci          }
380bc03f14fSopenharmony_ci          expect(data).assertEqual(true);
381bc03f14fSopenharmony_ci          systemPasteboard.getPasteData((err, data) => {
382bc03f14fSopenharmony_ci            if (err) {
383bc03f14fSopenharmony_ci              console.error('f_test8: systemPasteboard.getPasteData callback error:' + err);
384bc03f14fSopenharmony_ci              return;
385bc03f14fSopenharmony_ci            }
386bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(4);
387bc03f14fSopenharmony_ci            const MimeTypes8 = data.getMimeTypes();
388bc03f14fSopenharmony_ci            expect(MimeTypes8[0]).assertEqual(pasteboard.MIMETYPE_TEXT_WANT);
389bc03f14fSopenharmony_ci            expect(MimeTypes8[1]).assertEqual(pasteboard.MIMETYPE_TEXT_URI);
390bc03f14fSopenharmony_ci            expect(MimeTypes8[2]).assertEqual(pasteboard.MIMETYPE_TEXT_HTML);
391bc03f14fSopenharmony_ci            expect(MimeTypes8[3]).assertEqual(pasteboard.MIMETYPE_TEXT_PLAIN);
392bc03f14fSopenharmony_ci            done();
393bc03f14fSopenharmony_ci          });
394bc03f14fSopenharmony_ci        });
395bc03f14fSopenharmony_ci      });
396bc03f14fSopenharmony_ci    });
397bc03f14fSopenharmony_ci  });
398bc03f14fSopenharmony_ci
399bc03f14fSopenharmony_ci  /**
400bc03f14fSopenharmony_ci   * @tc.name      pasteboard_callback_test9
401bc03f14fSopenharmony_ci   * @tc.desc      addHtmlRecord+addUriRecord+removeRecordAt
402bc03f14fSopenharmony_ci   * @tc.type      Function
403bc03f14fSopenharmony_ci   * @tc.require   AR000HEECD
404bc03f14fSopenharmony_ci   */
405bc03f14fSopenharmony_ci  it('pasteboard_callback_test9', 0, async function (done) {
406bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
407bc03f14fSopenharmony_ci    systemPasteboard.clear((err, data) => {
408bc03f14fSopenharmony_ci      if (err) {
409bc03f14fSopenharmony_ci        console.error('f_test9: systemPasteboard.clear callback error:' + err);
410bc03f14fSopenharmony_ci        return;
411bc03f14fSopenharmony_ci      }
412bc03f14fSopenharmony_ci      const textData9 = 'Hello World!';
413bc03f14fSopenharmony_ci      const pasteData = pasteboard.createPlainTextData(textData9);
414bc03f14fSopenharmony_ci      const htmlText9 = '<html><head></head><body>Hello World!</body></html>';
415bc03f14fSopenharmony_ci      pasteData.addHtmlRecord(htmlText9);
416bc03f14fSopenharmony_ci      const uriText9 = '';
417bc03f14fSopenharmony_ci      pasteData.addUriRecord(uriText9);
418bc03f14fSopenharmony_ci      systemPasteboard.setPasteData(pasteData, (err, data) => {
419bc03f14fSopenharmony_ci        if (err) {
420bc03f14fSopenharmony_ci          console.error('f_test9: systemPasteboard.setPasteData callback error:' + err);
421bc03f14fSopenharmony_ci          return;
422bc03f14fSopenharmony_ci        }
423bc03f14fSopenharmony_ci        systemPasteboard.hasPasteData((err, data) => {
424bc03f14fSopenharmony_ci          if (err) {
425bc03f14fSopenharmony_ci            console.error('f_test9: systemPasteboard.hasPasteData callback error:' + err);
426bc03f14fSopenharmony_ci            return;
427bc03f14fSopenharmony_ci          }
428bc03f14fSopenharmony_ci          expect(data).assertEqual(true);
429bc03f14fSopenharmony_ci          systemPasteboard.getPasteData((err, data) => {
430bc03f14fSopenharmony_ci            if (err) {
431bc03f14fSopenharmony_ci              console.error('f_test9: systemPasteboard.getPasteData callback error:' + err);
432bc03f14fSopenharmony_ci              return;
433bc03f14fSopenharmony_ci            }
434bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(3);
435bc03f14fSopenharmony_ci            expect(data.removeRecordAt(0)).assertEqual(true);
436bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(2);
437bc03f14fSopenharmony_ci            systemPasteboard.setPasteData(data, (err, newdata) => {
438bc03f14fSopenharmony_ci              if (err) {
439bc03f14fSopenharmony_ci                console.error('f_test9: systemPasteboard.setPasteData callback error:' + err);
440bc03f14fSopenharmony_ci                return;
441bc03f14fSopenharmony_ci              }
442bc03f14fSopenharmony_ci              systemPasteboard.getPasteData((err, data) => {
443bc03f14fSopenharmony_ci                if (err) {
444bc03f14fSopenharmony_ci                  console.error('f_test9: systemPasteboard.getPasteData callback error:' + err);
445bc03f14fSopenharmony_ci                  return;
446bc03f14fSopenharmony_ci                }
447bc03f14fSopenharmony_ci                expect(data.getRecordCount()).assertEqual(2);
448bc03f14fSopenharmony_ci                done();
449bc03f14fSopenharmony_ci              });
450bc03f14fSopenharmony_ci            });
451bc03f14fSopenharmony_ci          });
452bc03f14fSopenharmony_ci        });
453bc03f14fSopenharmony_ci      });
454bc03f14fSopenharmony_ci    });
455bc03f14fSopenharmony_ci  });
456bc03f14fSopenharmony_ci
457bc03f14fSopenharmony_ci  /**
458bc03f14fSopenharmony_ci   * @tc.name      pasteboard_callback_test10
459bc03f14fSopenharmony_ci   * @tc.desc      Add 30 TextRecords
460bc03f14fSopenharmony_ci   * @tc.type      Function
461bc03f14fSopenharmony_ci   * @tc.require   AR000H5GKU
462bc03f14fSopenharmony_ci   */
463bc03f14fSopenharmony_ci  it('pasteboard_callback_test10', 0, async function (done) {
464bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
465bc03f14fSopenharmony_ci    systemPasteboard.clear((err, data) => {
466bc03f14fSopenharmony_ci      if (err) {
467bc03f14fSopenharmony_ci        console.error('f_test10: systemPasteboard.clear callback error:' + err);
468bc03f14fSopenharmony_ci        return;
469bc03f14fSopenharmony_ci      }
470bc03f14fSopenharmony_ci      const textData101 = 'Hello World!';
471bc03f14fSopenharmony_ci      const pasteData = pasteboard.createPlainTextData(textData101);
472bc03f14fSopenharmony_ci      let textData10 = '';
473bc03f14fSopenharmony_ci      for (let i = 1; i < 30; i++) {
474bc03f14fSopenharmony_ci        textData10 = 'Hello World';
475bc03f14fSopenharmony_ci        textData10 = textData10 + i;
476bc03f14fSopenharmony_ci        pasteData.addTextRecord(textData10);
477bc03f14fSopenharmony_ci      }
478bc03f14fSopenharmony_ci      systemPasteboard.setPasteData(pasteData, (err, data) => {
479bc03f14fSopenharmony_ci        if (err) {
480bc03f14fSopenharmony_ci          console.error('f_test10: systemPasteboard.setPasteData callback error:' + err);
481bc03f14fSopenharmony_ci          return;
482bc03f14fSopenharmony_ci        }
483bc03f14fSopenharmony_ci        systemPasteboard.hasPasteData((err, data) => {
484bc03f14fSopenharmony_ci          if (err) {
485bc03f14fSopenharmony_ci            console.error('f_test10: systemPasteboard.hasPasteData callback error:' + err);
486bc03f14fSopenharmony_ci            return;
487bc03f14fSopenharmony_ci          }
488bc03f14fSopenharmony_ci          expect(data).assertEqual(true);
489bc03f14fSopenharmony_ci          systemPasteboard.getPasteData((err, data) => {
490bc03f14fSopenharmony_ci            if (err) {
491bc03f14fSopenharmony_ci              console.error('f_test10: systemPasteboard.getPasteData callback error:' + err);
492bc03f14fSopenharmony_ci              return;
493bc03f14fSopenharmony_ci            }
494bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(30);
495bc03f14fSopenharmony_ci            for (let i = 0; i < 30; i++) {
496bc03f14fSopenharmony_ci              expect(data.removeRecordAt(0)).assertEqual(true);
497bc03f14fSopenharmony_ci            }
498bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(0);
499bc03f14fSopenharmony_ci            systemPasteboard.setPasteData(data, (err, newdata) => {
500bc03f14fSopenharmony_ci              if (err) {
501bc03f14fSopenharmony_ci                console.error('f_test10: systemPasteboard.setPasteData callback error:' + err);
502bc03f14fSopenharmony_ci                return;
503bc03f14fSopenharmony_ci              }
504bc03f14fSopenharmony_ci              systemPasteboard.getPasteData((err, data) => {
505bc03f14fSopenharmony_ci                if (err) {
506bc03f14fSopenharmony_ci                  console.error('f_test10: systemPasteboard.getPasteData callback error:' + err);
507bc03f14fSopenharmony_ci                  return;
508bc03f14fSopenharmony_ci                }
509bc03f14fSopenharmony_ci                expect(data.getRecordCount() == 0).assertEqual(true);
510bc03f14fSopenharmony_ci                done();
511bc03f14fSopenharmony_ci              });
512bc03f14fSopenharmony_ci            });
513bc03f14fSopenharmony_ci          });
514bc03f14fSopenharmony_ci        });
515bc03f14fSopenharmony_ci      });
516bc03f14fSopenharmony_ci    });
517bc03f14fSopenharmony_ci  });
518bc03f14fSopenharmony_ci
519bc03f14fSopenharmony_ci  /**
520bc03f14fSopenharmony_ci   * @tc.name      pasteboard_callback_test11
521bc03f14fSopenharmony_ci   * @tc.desc      Replcae textRecord
522bc03f14fSopenharmony_ci   * @tc.type      Function
523bc03f14fSopenharmony_ci   * @tc.require   AR000H5GKU
524bc03f14fSopenharmony_ci   */
525bc03f14fSopenharmony_ci  it('pasteboard_callback_test11', 0, async function (done) {
526bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
527bc03f14fSopenharmony_ci    systemPasteboard.clear((err, data) => {
528bc03f14fSopenharmony_ci      if (err) {
529bc03f14fSopenharmony_ci        console.error('f_test11: systemPasteboard.clear callback error:' + err);
530bc03f14fSopenharmony_ci        return;
531bc03f14fSopenharmony_ci      }
532bc03f14fSopenharmony_ci      const textData11 = 'Hello World!';
533bc03f14fSopenharmony_ci      const pasteData = pasteboard.createPlainTextData(textData11);
534bc03f14fSopenharmony_ci      systemPasteboard.setPasteData(pasteData, (err, data) => {
535bc03f14fSopenharmony_ci        if (err) {
536bc03f14fSopenharmony_ci          console.error('f_test11: systemPasteboard.setPasteData callback error:' + err);
537bc03f14fSopenharmony_ci          return;
538bc03f14fSopenharmony_ci        }
539bc03f14fSopenharmony_ci        systemPasteboard.hasPasteData((err, data) => {
540bc03f14fSopenharmony_ci          if (err) {
541bc03f14fSopenharmony_ci            console.error('f_test11: systemPasteboard.hasPasteData callback error:' + err);
542bc03f14fSopenharmony_ci            return;
543bc03f14fSopenharmony_ci          }
544bc03f14fSopenharmony_ci          expect(data).assertEqual(true);
545bc03f14fSopenharmony_ci          systemPasteboard.getPasteData((err, data) => {
546bc03f14fSopenharmony_ci            if (err) {
547bc03f14fSopenharmony_ci              console.error('f_test11: systemPasteboard.getPasteData callback error:' + err);
548bc03f14fSopenharmony_ci              return;
549bc03f14fSopenharmony_ci            }
550bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(1);
551bc03f14fSopenharmony_ci            const textData111 = 'Hello World1';
552bc03f14fSopenharmony_ci            const pasteDataRecord11 = pasteboard.createPlainTextRecord(textData111);
553bc03f14fSopenharmony_ci            const replace11 = data.replaceRecordAt(0, pasteDataRecord11);
554bc03f14fSopenharmony_ci            expect(replace11).assertEqual(true);
555bc03f14fSopenharmony_ci            const primaryText11 = data.getPrimaryText();
556bc03f14fSopenharmony_ci            expect(primaryText11).assertEqual(textData111);
557bc03f14fSopenharmony_ci            done();
558bc03f14fSopenharmony_ci          });
559bc03f14fSopenharmony_ci        });
560bc03f14fSopenharmony_ci      });
561bc03f14fSopenharmony_ci    });
562bc03f14fSopenharmony_ci  });
563bc03f14fSopenharmony_ci
564bc03f14fSopenharmony_ci  /**
565bc03f14fSopenharmony_ci   * @tc.name      pasteboard_callback_test12
566bc03f14fSopenharmony_ci   * @tc.desc      Replcae htmlRecord
567bc03f14fSopenharmony_ci   * @tc.type      Function
568bc03f14fSopenharmony_ci   * @tc.require   AR000H5GKU
569bc03f14fSopenharmony_ci   */
570bc03f14fSopenharmony_ci  it('pasteboard_callback_test12', 0, async function (done) {
571bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
572bc03f14fSopenharmony_ci    systemPasteboard.clear((err, data) => {
573bc03f14fSopenharmony_ci      if (err) {
574bc03f14fSopenharmony_ci        console.error('f_test12: systemPasteboard.clear callback error:' + err);
575bc03f14fSopenharmony_ci        return;
576bc03f14fSopenharmony_ci      }
577bc03f14fSopenharmony_ci      const htmlText12 = '<html><head></head><body>Hello World!</body></html>';
578bc03f14fSopenharmony_ci      const pasteData = pasteboard.createHtmlData(htmlText12);
579bc03f14fSopenharmony_ci      systemPasteboard.setPasteData(pasteData, (err, data) => {
580bc03f14fSopenharmony_ci        if (err) {
581bc03f14fSopenharmony_ci          console.error('f_test12: systemPasteboard.setPasteData callback error:' + err);
582bc03f14fSopenharmony_ci          return;
583bc03f14fSopenharmony_ci        }
584bc03f14fSopenharmony_ci        systemPasteboard.hasPasteData((err, data) => {
585bc03f14fSopenharmony_ci          if (err) {
586bc03f14fSopenharmony_ci            console.error('f_test12: systemPasteboard.hasPasteData callback error:' + err);
587bc03f14fSopenharmony_ci            return;
588bc03f14fSopenharmony_ci          }
589bc03f14fSopenharmony_ci          expect(data).assertEqual(true);
590bc03f14fSopenharmony_ci          systemPasteboard.getPasteData((err, data) => {
591bc03f14fSopenharmony_ci            if (err) {
592bc03f14fSopenharmony_ci              console.error('f_test12: systemPasteboard.getPasteData callback error:' + err);
593bc03f14fSopenharmony_ci              return;
594bc03f14fSopenharmony_ci            }
595bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(1);
596bc03f14fSopenharmony_ci            const htmlText121 = '<html><head></head><body>Hello World 1</body></html>';
597bc03f14fSopenharmony_ci            const pasteDataRecord12 = pasteboard.createHtmlTextRecord(htmlText121);
598bc03f14fSopenharmony_ci            const replace12 = data.replaceRecordAt(0, pasteDataRecord12);
599bc03f14fSopenharmony_ci            expect(replace12).assertEqual(true);
600bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(1);
601bc03f14fSopenharmony_ci            const primaryHtml12 = data.getPrimaryHtml();
602bc03f14fSopenharmony_ci            expect(primaryHtml12).assertEqual(htmlText121);
603bc03f14fSopenharmony_ci            done();
604bc03f14fSopenharmony_ci          });
605bc03f14fSopenharmony_ci        });
606bc03f14fSopenharmony_ci      });
607bc03f14fSopenharmony_ci    });
608bc03f14fSopenharmony_ci  });
609bc03f14fSopenharmony_ci
610bc03f14fSopenharmony_ci  /**
611bc03f14fSopenharmony_ci   * @tc.name      pasteboard_callback_test13
612bc03f14fSopenharmony_ci   * @tc.desc      Replcae wantRecord
613bc03f14fSopenharmony_ci   * @tc.type      Function
614bc03f14fSopenharmony_ci   * @tc.require   AR000H5GKU
615bc03f14fSopenharmony_ci   */
616bc03f14fSopenharmony_ci  it('pasteboard_callback_test13', 0, async function (done) {
617bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
618bc03f14fSopenharmony_ci    systemPasteboard.clear((err, data) => {
619bc03f14fSopenharmony_ci      if (err) {
620bc03f14fSopenharmony_ci        console.error('f_test13: systemPasteboard.clear callback error:' + err);
621bc03f14fSopenharmony_ci        return;
622bc03f14fSopenharmony_ci      }
623bc03f14fSopenharmony_ci      const wantText13 = {
624bc03f14fSopenharmony_ci        bundleName: 'com.example.myapplication3',
625bc03f14fSopenharmony_ci        abilityName: 'com.example.myapplication3.MainAbility',
626bc03f14fSopenharmony_ci      };
627bc03f14fSopenharmony_ci      const pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_WANT, wantText13);
628bc03f14fSopenharmony_ci      systemPasteboard.setPasteData(pasteData, (err, data) => {
629bc03f14fSopenharmony_ci        if (err) {
630bc03f14fSopenharmony_ci          console.error('f_test13: systemPasteboard.setPasteData callback error:' + err);
631bc03f14fSopenharmony_ci          return;
632bc03f14fSopenharmony_ci        }
633bc03f14fSopenharmony_ci        systemPasteboard.hasPasteData((err, data) => {
634bc03f14fSopenharmony_ci          if (err) {
635bc03f14fSopenharmony_ci            console.error('f_test13: systemPasteboard.hasPasteData callback error:' + err);
636bc03f14fSopenharmony_ci            return;
637bc03f14fSopenharmony_ci          }
638bc03f14fSopenharmony_ci          expect(data).assertEqual(true);
639bc03f14fSopenharmony_ci          systemPasteboard.getPasteData((err, data) => {
640bc03f14fSopenharmony_ci            if (err) {
641bc03f14fSopenharmony_ci              console.error('f_test13: systemPasteboard.getPasteData callback error:' + err);
642bc03f14fSopenharmony_ci              return;
643bc03f14fSopenharmony_ci            }
644bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(1);
645bc03f14fSopenharmony_ci            const getWantText13 = {
646bc03f14fSopenharmony_ci              bundleName: 'com.example.myapplication30',
647bc03f14fSopenharmony_ci              abilityName: 'com.example.myapplication30.MainAbility',
648bc03f14fSopenharmony_ci            };
649bc03f14fSopenharmony_ci            const pasteDataRecord13 = pasteboard.createRecord(pasteboard.MIMETYPE_TEXT_WANT, getWantText13);
650bc03f14fSopenharmony_ci            const replace13 = data.replaceRecordAt(0, pasteDataRecord13);
651bc03f14fSopenharmony_ci            expect(replace13).assertEqual(true);
652bc03f14fSopenharmony_ci            const primaryWant13 = data.getPrimaryWant();
653bc03f14fSopenharmony_ci            expect(data.hasMimeType(pasteboard.MIMETYPE_TEXT_WANT)).assertEqual(true);
654bc03f14fSopenharmony_ci            expect(primaryWant13.bundleName).assertEqual(getWantText13.bundleName);
655bc03f14fSopenharmony_ci            expect(primaryWant13.abilityName).assertEqual(getWantText13.abilityName);
656bc03f14fSopenharmony_ci            done();
657bc03f14fSopenharmony_ci          });
658bc03f14fSopenharmony_ci        });
659bc03f14fSopenharmony_ci      });
660bc03f14fSopenharmony_ci    });
661bc03f14fSopenharmony_ci  });
662bc03f14fSopenharmony_ci
663bc03f14fSopenharmony_ci  /**
664bc03f14fSopenharmony_ci   * @tc.name      pasteboard_callback_test14
665bc03f14fSopenharmony_ci   * @tc.desc      get pasteData after clear wantData
666bc03f14fSopenharmony_ci   * @tc.type      Function
667bc03f14fSopenharmony_ci   * @tc.require   AR000H5GKU
668bc03f14fSopenharmony_ci   */
669bc03f14fSopenharmony_ci  it('pasteboard_callback_test14', 0, async function (done) {
670bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
671bc03f14fSopenharmony_ci    systemPasteboard.clear((err, data) => {
672bc03f14fSopenharmony_ci      if (err) {
673bc03f14fSopenharmony_ci        console.error('f_test14: systemPasteboard.clear callback error:' + err);
674bc03f14fSopenharmony_ci        return;
675bc03f14fSopenharmony_ci      }
676bc03f14fSopenharmony_ci      const wantText14 = {
677bc03f14fSopenharmony_ci        bundleName: 'com.example.myapplication3',
678bc03f14fSopenharmony_ci        abilityName: 'com.example.myapplication3.MainAbility',
679bc03f14fSopenharmony_ci      };
680bc03f14fSopenharmony_ci      const pasteData = pasteboard.createWantData(wantText14);
681bc03f14fSopenharmony_ci      systemPasteboard.setPasteData(pasteData, (err, data) => {
682bc03f14fSopenharmony_ci        if (err) {
683bc03f14fSopenharmony_ci          console.error('f_test14: systemPasteboard.setPasteData callback error:' + err);
684bc03f14fSopenharmony_ci          return;
685bc03f14fSopenharmony_ci        }
686bc03f14fSopenharmony_ci        systemPasteboard.hasPasteData((err, data) => {
687bc03f14fSopenharmony_ci          if (err) {
688bc03f14fSopenharmony_ci            console.error('f_test14: systemPasteboard.hasPasteData callback error:' + err);
689bc03f14fSopenharmony_ci            return;
690bc03f14fSopenharmony_ci          }
691bc03f14fSopenharmony_ci          expect(data).assertEqual(true);
692bc03f14fSopenharmony_ci          systemPasteboard.getPasteData((err, data) => {
693bc03f14fSopenharmony_ci            if (err) {
694bc03f14fSopenharmony_ci              console.error('f_test14: systemPasteboard.getPasteData callback error:' + err);
695bc03f14fSopenharmony_ci              return;
696bc03f14fSopenharmony_ci            }
697bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(1);
698bc03f14fSopenharmony_ci            systemPasteboard.clear((err, data) => {
699bc03f14fSopenharmony_ci              if (err) {
700bc03f14fSopenharmony_ci                console.error('f_test14: systemPasteboard.clear callback error:' + err);
701bc03f14fSopenharmony_ci                return;
702bc03f14fSopenharmony_ci              }
703bc03f14fSopenharmony_ci              systemPasteboard.getPasteData((err, data) => {
704bc03f14fSopenharmony_ci                if (err) {
705bc03f14fSopenharmony_ci                  console.error('f_test14: systemPasteboard.getPasteData callback error:' + err);
706bc03f14fSopenharmony_ci                  return;
707bc03f14fSopenharmony_ci                }
708bc03f14fSopenharmony_ci                expect(data.getRecordCount()).assertEqual(0);
709bc03f14fSopenharmony_ci                done();
710bc03f14fSopenharmony_ci              });
711bc03f14fSopenharmony_ci            });
712bc03f14fSopenharmony_ci          });
713bc03f14fSopenharmony_ci        });
714bc03f14fSopenharmony_ci      });
715bc03f14fSopenharmony_ci    });
716bc03f14fSopenharmony_ci  });
717bc03f14fSopenharmony_ci
718bc03f14fSopenharmony_ci  /**
719bc03f14fSopenharmony_ci   * @tc.name      pasteboard_callback_test15
720bc03f14fSopenharmony_ci   * @tc.desc      getProperty and setProperty test
721bc03f14fSopenharmony_ci   * @tc.require   AR000H5GKU
722bc03f14fSopenharmony_ci   */
723bc03f14fSopenharmony_ci  it('pasteboard_callback_test15', 0, async function (done) {
724bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
725bc03f14fSopenharmony_ci    systemPasteboard.clear((err, data) => {
726bc03f14fSopenharmony_ci      if (err) {
727bc03f14fSopenharmony_ci        console.error('f_test15: systemPasteboard.clear callback error:' + err);
728bc03f14fSopenharmony_ci        return;
729bc03f14fSopenharmony_ci      }
730bc03f14fSopenharmony_ci      const textData15 = 'Hello World!';
731bc03f14fSopenharmony_ci      const pasteData = pasteboard.createPlainTextData(textData15);
732bc03f14fSopenharmony_ci      systemPasteboard.setPasteData(pasteData, (err, data) => {
733bc03f14fSopenharmony_ci        if (err) {
734bc03f14fSopenharmony_ci          console.error('f_test15: systemPasteboard.setPasteData callback error:' + err);
735bc03f14fSopenharmony_ci          return;
736bc03f14fSopenharmony_ci        }
737bc03f14fSopenharmony_ci        systemPasteboard.hasPasteData((err, data) => {
738bc03f14fSopenharmony_ci          if (err) {
739bc03f14fSopenharmony_ci            console.error('f_test15: systemPasteboard.hasPasteData callback error:' + err);
740bc03f14fSopenharmony_ci            return;
741bc03f14fSopenharmony_ci          }
742bc03f14fSopenharmony_ci          expect(data).assertEqual(true);
743bc03f14fSopenharmony_ci          systemPasteboard.getPasteData((err, data) => {
744bc03f14fSopenharmony_ci            if (err) {
745bc03f14fSopenharmony_ci              console.error('f_test15: systemPasteboard.getPasteData callback error:' + err);
746bc03f14fSopenharmony_ci              return;
747bc03f14fSopenharmony_ci            }
748bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(1);
749bc03f14fSopenharmony_ci            const pasteDataProperty15 = data.getProperty();
750bc03f14fSopenharmony_ci            expect(pasteDataProperty15.shareOption).assertEqual(pasteboard.ShareOption.CrossDevice);
751bc03f14fSopenharmony_ci            pasteDataProperty15.shareOption = pasteboard.ShareOption.InApp;
752bc03f14fSopenharmony_ci            data.setProperty(pasteDataProperty15);
753bc03f14fSopenharmony_ci            const getPasteDataProperty15 = data.getProperty();
754bc03f14fSopenharmony_ci            expect(getPasteDataProperty15.shareOption).assertEqual(pasteboard.ShareOption.InApp);
755bc03f14fSopenharmony_ci            done();
756bc03f14fSopenharmony_ci          });
757bc03f14fSopenharmony_ci        });
758bc03f14fSopenharmony_ci      });
759bc03f14fSopenharmony_ci    });
760bc03f14fSopenharmony_ci  });
761bc03f14fSopenharmony_ci
762bc03f14fSopenharmony_ci  /**
763bc03f14fSopenharmony_ci   * @tc.name      pasteboard_callback_test16
764bc03f14fSopenharmony_ci   * @tc.desc      on test
765bc03f14fSopenharmony_ci   * @tc.type      Function
766bc03f14fSopenharmony_ci   * @tc.require   AR000H5GKU
767bc03f14fSopenharmony_ci   */
768bc03f14fSopenharmony_ci  it('pasteboard_callback_test16', 0, async function (done) {
769bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
770bc03f14fSopenharmony_ci    systemPasteboard.clear((err, data) => {
771bc03f14fSopenharmony_ci      if (err) {
772bc03f14fSopenharmony_ci        console.error('f_test16: systemPasteboard.clear callback error:' + err);
773bc03f14fSopenharmony_ci        return;
774bc03f14fSopenharmony_ci      }
775bc03f14fSopenharmony_ci      systemPasteboard.on('update', contentChanges);
776bc03f14fSopenharmony_ci      const textData16 = 'Hello World!';
777bc03f14fSopenharmony_ci      const pasteData = pasteboard.createPlainTextData(textData16);
778bc03f14fSopenharmony_ci      systemPasteboard.setPasteData(pasteData, (err, data) => {
779bc03f14fSopenharmony_ci        if (err) {
780bc03f14fSopenharmony_ci          console.error('f_test16: systemPasteboard.setPasteData callback error:' + err);
781bc03f14fSopenharmony_ci          return;
782bc03f14fSopenharmony_ci        }
783bc03f14fSopenharmony_ci        systemPasteboard.hasPasteData((err, data) => {
784bc03f14fSopenharmony_ci          if (err) {
785bc03f14fSopenharmony_ci            console.error('f_test16: systemPasteboard.hasPasteData callback error:' + err);
786bc03f14fSopenharmony_ci            return;
787bc03f14fSopenharmony_ci          }
788bc03f14fSopenharmony_ci          expect(data === true).assertEqual(true);
789bc03f14fSopenharmony_ci          systemPasteboard.getPasteData((err, data) => {
790bc03f14fSopenharmony_ci            if (err) {
791bc03f14fSopenharmony_ci              console.error('f_test16: systemPasteboard.getPasteData callback error:' + err);
792bc03f14fSopenharmony_ci              return;
793bc03f14fSopenharmony_ci            }
794bc03f14fSopenharmony_ci            expect(data.getRecordCount() == 1).assertEqual(true);
795bc03f14fSopenharmony_ci            expect(data.removeRecordAt(0)).assertEqual(true);
796bc03f14fSopenharmony_ci            expect(data.getRecordCount() == 0).assertEqual(true);
797bc03f14fSopenharmony_ci            done();
798bc03f14fSopenharmony_ci          });
799bc03f14fSopenharmony_ci        });
800bc03f14fSopenharmony_ci      });
801bc03f14fSopenharmony_ci    });
802bc03f14fSopenharmony_ci  });
803bc03f14fSopenharmony_ci
804bc03f14fSopenharmony_ci  /**
805bc03f14fSopenharmony_ci   * @tc.name      pasteboard_callback_test17
806bc03f14fSopenharmony_ci   * @tc.desc      off test
807bc03f14fSopenharmony_ci   * @tc.type      Function
808bc03f14fSopenharmony_ci   * @tc.require   AR000H5GKU
809bc03f14fSopenharmony_ci   */
810bc03f14fSopenharmony_ci  it('pasteboard_callback_test17', 0, async function (done) {
811bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
812bc03f14fSopenharmony_ci    systemPasteboard.clear((err, data) => {
813bc03f14fSopenharmony_ci      if (err) {
814bc03f14fSopenharmony_ci        console.error('f_test17: systemPasteboard.clear callback error:' + err);
815bc03f14fSopenharmony_ci        return;
816bc03f14fSopenharmony_ci      }
817bc03f14fSopenharmony_ci      systemPasteboard.off('update', contentChanges);
818bc03f14fSopenharmony_ci      const textData17 = 'Hello World!';
819bc03f14fSopenharmony_ci      const pasteData = pasteboard.createPlainTextData(textData17);
820bc03f14fSopenharmony_ci      systemPasteboard.setPasteData(pasteData, (err, data) => {
821bc03f14fSopenharmony_ci        if (err) {
822bc03f14fSopenharmony_ci          console.error('f_test17: systemPasteboard.setPasteData callback error:' + err);
823bc03f14fSopenharmony_ci          return;
824bc03f14fSopenharmony_ci        }
825bc03f14fSopenharmony_ci        systemPasteboard.hasPasteData((err, data) => {
826bc03f14fSopenharmony_ci          if (err) {
827bc03f14fSopenharmony_ci            console.error('f_test17: systemPasteboard.hasPasteData callback error:' + err);
828bc03f14fSopenharmony_ci            return;
829bc03f14fSopenharmony_ci          }
830bc03f14fSopenharmony_ci          expect(data).assertEqual(true);
831bc03f14fSopenharmony_ci          systemPasteboard.getPasteData((err, data) => {
832bc03f14fSopenharmony_ci            if (err) {
833bc03f14fSopenharmony_ci              console.error('f_test17: systemPasteboard.getPasteData callback error:' + err);
834bc03f14fSopenharmony_ci              return;
835bc03f14fSopenharmony_ci            }
836bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(1);
837bc03f14fSopenharmony_ci            expect(data.removeRecordAt(0)).assertEqual(true);
838bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(0);
839bc03f14fSopenharmony_ci            done();
840bc03f14fSopenharmony_ci          });
841bc03f14fSopenharmony_ci        });
842bc03f14fSopenharmony_ci      });
843bc03f14fSopenharmony_ci    });
844bc03f14fSopenharmony_ci  });
845bc03f14fSopenharmony_ci
846bc03f14fSopenharmony_ci  /**
847bc03f14fSopenharmony_ci   * @tc.name      pasteboard_callback_test18
848bc03f14fSopenharmony_ci   * @tc.desc      createRecord test
849bc03f14fSopenharmony_ci   * @tc.type      Function
850bc03f14fSopenharmony_ci   * @tc.require   AR000H5GKU
851bc03f14fSopenharmony_ci   */
852bc03f14fSopenharmony_ci  it('pasteboard_callback_test18', 0, async function (done) {
853bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
854bc03f14fSopenharmony_ci    systemPasteboard.clear().then(() => {
855bc03f14fSopenharmony_ci      const buffer18 = new ArrayBuffer(128);
856bc03f14fSopenharmony_ci      const opt18 = {
857bc03f14fSopenharmony_ci        size: { height: 5, width: 5 },
858bc03f14fSopenharmony_ci        pixelFormat: 3,
859bc03f14fSopenharmony_ci        editable: true,
860bc03f14fSopenharmony_ci        alphaType: 1,
861bc03f14fSopenharmony_ci        scaleMode: 1,
862bc03f14fSopenharmony_ci      };
863bc03f14fSopenharmony_ci      const pasteData = pasteboard.createHtmlData('application/xml');
864bc03f14fSopenharmony_ci      image.createPixelMap(buffer18, opt18).then((pixelMap) => {
865bc03f14fSopenharmony_ci        expect(pixelMap.getPixelBytesNumber()).assertEqual(100);
866bc03f14fSopenharmony_ci        const pixelMapRecord18 = pasteboard.createRecord(pasteboard.MIMETYPE_PIXELMAP, pixelMap);
867bc03f14fSopenharmony_ci        pasteData.addRecord(pixelMapRecord18);
868bc03f14fSopenharmony_ci        systemPasteboard.setPasteData(pasteData).then(() => {
869bc03f14fSopenharmony_ci          systemPasteboard.hasPasteData().then((data) => {
870bc03f14fSopenharmony_ci            expect(data).assertEqual(true);
871bc03f14fSopenharmony_ci            systemPasteboard.getPasteData().then((newPasteData) => {
872bc03f14fSopenharmony_ci              const recordCount18 = newPasteData.getRecordCount();
873bc03f14fSopenharmony_ci              expect(recordCount18).assertEqual(2);
874bc03f14fSopenharmony_ci              const newPixelMap18 = newPasteData.getPrimaryPixelMap();
875bc03f14fSopenharmony_ci              const PixelMapBytesNumber18 = newPixelMap18.getPixelBytesNumber();
876bc03f14fSopenharmony_ci              expect(PixelMapBytesNumber18).assertEqual(100);
877bc03f14fSopenharmony_ci              const newHtmlData18 = newPasteData.getRecordAt(1);
878bc03f14fSopenharmony_ci              expect(newHtmlData18.htmlText).assertEqual('application/xml');
879bc03f14fSopenharmony_ci              newPixelMap18.getImageInfo().then((imageInfo) => {
880bc03f14fSopenharmony_ci                expect(imageInfo.size.height === 5 && imageInfo.size.width === 5).assertEqual(true);
881bc03f14fSopenharmony_ci                done();
882bc03f14fSopenharmony_ci              });
883bc03f14fSopenharmony_ci            });
884bc03f14fSopenharmony_ci          });
885bc03f14fSopenharmony_ci        });
886bc03f14fSopenharmony_ci      });
887bc03f14fSopenharmony_ci    });
888bc03f14fSopenharmony_ci  });
889bc03f14fSopenharmony_ci
890bc03f14fSopenharmony_ci  /**
891bc03f14fSopenharmony_ci   * @tc.name      pasteboard_callback_test19
892bc03f14fSopenharmony_ci   * @tc.desc      Add plainText、htmlText、uriText record
893bc03f14fSopenharmony_ci   * @tc.type      Function
894bc03f14fSopenharmony_ci   * @tc.require   AR000H5GKU
895bc03f14fSopenharmony_ci   */
896bc03f14fSopenharmony_ci  it('pasteboard_callback_test19', 0, async function (done) {
897bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
898bc03f14fSopenharmony_ci    systemPasteboard.clear((err, data) => {
899bc03f14fSopenharmony_ci      if (err) {
900bc03f14fSopenharmony_ci        console.error('f_test19: systemPasteboard.clear callback error:' + err);
901bc03f14fSopenharmony_ci        return;
902bc03f14fSopenharmony_ci      }
903bc03f14fSopenharmony_ci      const textData191 = 'Hello World0';
904bc03f14fSopenharmony_ci      const pasteData = pasteboard.createPlainTextData(textData191);
905bc03f14fSopenharmony_ci      let textData19 = '';
906bc03f14fSopenharmony_ci      for (let i = 1; i < 5; i++) {
907bc03f14fSopenharmony_ci        textData19 = 'Hello World';
908bc03f14fSopenharmony_ci        textData19 = textData19 + i;
909bc03f14fSopenharmony_ci        pasteData.addTextRecord(textData19);
910bc03f14fSopenharmony_ci      }
911bc03f14fSopenharmony_ci      let htmlText19 = '';
912bc03f14fSopenharmony_ci      for (let i = 0; i < 5; i++) {
913bc03f14fSopenharmony_ci        htmlText19 = '<html><head></head><body>Hello World!</body></html>';
914bc03f14fSopenharmony_ci        htmlText19 = htmlText19 + i;
915bc03f14fSopenharmony_ci        pasteData.addHtmlRecord(htmlText19);
916bc03f14fSopenharmony_ci      }
917bc03f14fSopenharmony_ci      let uriText19 = '';
918bc03f14fSopenharmony_ci      for (let i = 0; i < 5; i++) {
919bc03f14fSopenharmony_ci        uriText19 = 'https://www.baidu.com/';
920bc03f14fSopenharmony_ci        uriText19 = uriText19 + i;
921bc03f14fSopenharmony_ci        pasteData.addUriRecord(uriText19);
922bc03f14fSopenharmony_ci      }
923bc03f14fSopenharmony_ci      systemPasteboard.setPasteData(pasteData, (err, data) => {
924bc03f14fSopenharmony_ci        if (err) {
925bc03f14fSopenharmony_ci          console.error('f_test19: systemPasteboard.setPasteData callback error:' + err);
926bc03f14fSopenharmony_ci          return;
927bc03f14fSopenharmony_ci        }
928bc03f14fSopenharmony_ci        systemPasteboard.hasPasteData((err, data) => {
929bc03f14fSopenharmony_ci          if (err) {
930bc03f14fSopenharmony_ci            console.error('f_test19: systemPasteboard.hasPasteData callback error:' + err);
931bc03f14fSopenharmony_ci            return;
932bc03f14fSopenharmony_ci          }
933bc03f14fSopenharmony_ci          expect(data).assertEqual(true);
934bc03f14fSopenharmony_ci          systemPasteboard.getPasteData(async (err, data) => {
935bc03f14fSopenharmony_ci            if (err) {
936bc03f14fSopenharmony_ci              console.error('f_test19: systemPasteboard.getPasteData callback error:' + err);
937bc03f14fSopenharmony_ci              return;
938bc03f14fSopenharmony_ci            }
939bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(15);
940bc03f14fSopenharmony_ci            await systemPasteboard.clear();
941bc03f14fSopenharmony_ci            let newData19 = await systemPasteboard.getPasteData();
942bc03f14fSopenharmony_ci            expect(newData19.getRecordCount()).assertEqual(0);
943bc03f14fSopenharmony_ci            done();
944bc03f14fSopenharmony_ci          });
945bc03f14fSopenharmony_ci        });
946bc03f14fSopenharmony_ci      });
947bc03f14fSopenharmony_ci    });
948bc03f14fSopenharmony_ci  });
949bc03f14fSopenharmony_ci
950bc03f14fSopenharmony_ci  /**
951bc03f14fSopenharmony_ci   * @tc.name      pasteboard_callback_test20
952bc03f14fSopenharmony_ci   * @tc.desc      convertToText test
953bc03f14fSopenharmony_ci   * @tc.type      Function
954bc03f14fSopenharmony_ci   * @tc.require   AR000H5GKU
955bc03f14fSopenharmony_ci   */
956bc03f14fSopenharmony_ci  it('pasteboard_callback_test20', 0, async function (done) {
957bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
958bc03f14fSopenharmony_ci    systemPasteboard.clear((err, data) => {
959bc03f14fSopenharmony_ci      if (err) {
960bc03f14fSopenharmony_ci        console.error('f_test20: systemPasteboard.clear callback error:' + err);
961bc03f14fSopenharmony_ci        return;
962bc03f14fSopenharmony_ci      }
963bc03f14fSopenharmony_ci      const textData20 = 'Hello World!';
964bc03f14fSopenharmony_ci      const pasteData = pasteboard.createPlainTextData(textData20);
965bc03f14fSopenharmony_ci      systemPasteboard.setPasteData(pasteData, (err, data) => {
966bc03f14fSopenharmony_ci        if (err) {
967bc03f14fSopenharmony_ci          console.error('f_test20: systemPasteboard.setPasteData callback error:' + err);
968bc03f14fSopenharmony_ci          return;
969bc03f14fSopenharmony_ci        }
970bc03f14fSopenharmony_ci        systemPasteboard.hasPasteData((err, data) => {
971bc03f14fSopenharmony_ci          if (err) {
972bc03f14fSopenharmony_ci            console.error('f_test20: systemPasteboard.hasPasteData callback error:' + err);
973bc03f14fSopenharmony_ci            return;
974bc03f14fSopenharmony_ci          }
975bc03f14fSopenharmony_ci          expect(data).assertEqual(true);
976bc03f14fSopenharmony_ci          systemPasteboard.getPasteData(async (err, data) => {
977bc03f14fSopenharmony_ci            if (err) {
978bc03f14fSopenharmony_ci              console.error('f_test20: systemPasteboard.getPasteData callback error:' + err);
979bc03f14fSopenharmony_ci              return;
980bc03f14fSopenharmony_ci            }
981bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(1);
982bc03f14fSopenharmony_ci            const dataRecord20 = data.getRecordAt(0);
983bc03f14fSopenharmony_ci            const text = await dataRecord20.convertToText();
984bc03f14fSopenharmony_ci            expect(text).assertEqual(textData20);
985bc03f14fSopenharmony_ci            done();
986bc03f14fSopenharmony_ci          });
987bc03f14fSopenharmony_ci        });
988bc03f14fSopenharmony_ci      });
989bc03f14fSopenharmony_ci    });
990bc03f14fSopenharmony_ci  });
991bc03f14fSopenharmony_ci
992bc03f14fSopenharmony_ci  /**
993bc03f14fSopenharmony_ci   * @tc.name      pasteboard_callback_test21
994bc03f14fSopenharmony_ci   * @tc.desc      convertToText test
995bc03f14fSopenharmony_ci   * @tc.type      Function
996bc03f14fSopenharmony_ci   * @tc.require   AR000H5GKU
997bc03f14fSopenharmony_ci   */
998bc03f14fSopenharmony_ci  it('pasteboard_callback_test21', 0, async function (done) {
999bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
1000bc03f14fSopenharmony_ci    systemPasteboard.clear((err, data) => {
1001bc03f14fSopenharmony_ci      if (err) {
1002bc03f14fSopenharmony_ci        console.error('f_test21: systemPasteboard.clear callback error:' + err);
1003bc03f14fSopenharmony_ci        return;
1004bc03f14fSopenharmony_ci      }
1005bc03f14fSopenharmony_ci      const textData21 = 'Hello World!';
1006bc03f14fSopenharmony_ci      const pasteData = pasteboard.createPlainTextData(textData21);
1007bc03f14fSopenharmony_ci      systemPasteboard.setPasteData(pasteData, (err, data) => {
1008bc03f14fSopenharmony_ci        if (err) {
1009bc03f14fSopenharmony_ci          console.error('f_test21: systemPasteboard.setPasteData callback error:' + err);
1010bc03f14fSopenharmony_ci          return;
1011bc03f14fSopenharmony_ci        }
1012bc03f14fSopenharmony_ci        systemPasteboard.hasPasteData((err, data) => {
1013bc03f14fSopenharmony_ci          if (err) {
1014bc03f14fSopenharmony_ci            console.error('f_test21: systemPasteboard.hasPasteData callback error:' + err);
1015bc03f14fSopenharmony_ci            return;
1016bc03f14fSopenharmony_ci          }
1017bc03f14fSopenharmony_ci          expect(data).assertEqual(true);
1018bc03f14fSopenharmony_ci          systemPasteboard.getPasteData((err, data) => {
1019bc03f14fSopenharmony_ci            if (err) {
1020bc03f14fSopenharmony_ci              console.error('f_test21: systemPasteboard.getPasteData callback error:' + err);
1021bc03f14fSopenharmony_ci              return;
1022bc03f14fSopenharmony_ci            }
1023bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(1);
1024bc03f14fSopenharmony_ci            const dataRecord21 = data.getRecordAt(0);
1025bc03f14fSopenharmony_ci            dataRecord21.convertToText((err, data) => {
1026bc03f14fSopenharmony_ci              if (err) {
1027bc03f14fSopenharmony_ci                console.error('f_test21: PasteDataRecord.convertToText callback error:' + err);
1028bc03f14fSopenharmony_ci                return;
1029bc03f14fSopenharmony_ci              }
1030bc03f14fSopenharmony_ci              expect(data).assertEqual(textData21);
1031bc03f14fSopenharmony_ci              done();
1032bc03f14fSopenharmony_ci            });
1033bc03f14fSopenharmony_ci          });
1034bc03f14fSopenharmony_ci        });
1035bc03f14fSopenharmony_ci      });
1036bc03f14fSopenharmony_ci    });
1037bc03f14fSopenharmony_ci  });
1038bc03f14fSopenharmony_ci
1039bc03f14fSopenharmony_ci  /**
1040bc03f14fSopenharmony_ci   * @tc.name      pasteboard_callback_test22
1041bc03f14fSopenharmony_ci   * @tc.desc      convertToText test
1042bc03f14fSopenharmony_ci   * @tc.type      Function
1043bc03f14fSopenharmony_ci   * @tc.require   AR000H5GKU
1044bc03f14fSopenharmony_ci   */
1045bc03f14fSopenharmony_ci  it('pasteboard_callback_test22', 0, async function (done) {
1046bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
1047bc03f14fSopenharmony_ci    systemPasteboard.clear((err, data) => {
1048bc03f14fSopenharmony_ci      if (err) {
1049bc03f14fSopenharmony_ci        console.error('f_test22: systemPasteboard.clear callback error:' + err);
1050bc03f14fSopenharmony_ci        return;
1051bc03f14fSopenharmony_ci      }
1052bc03f14fSopenharmony_ci      const textData22 = 'Hello 中国!@#$%^&*()_+{}\\?.';
1053bc03f14fSopenharmony_ci      const pasteData = pasteboard.createPlainTextData(textData22);
1054bc03f14fSopenharmony_ci      systemPasteboard.setPasteData(pasteData, (err, data) => {
1055bc03f14fSopenharmony_ci        if (err) {
1056bc03f14fSopenharmony_ci          console.error('f_test22: systemPasteboard.setPasteData callback error:' + err);
1057bc03f14fSopenharmony_ci          return;
1058bc03f14fSopenharmony_ci        }
1059bc03f14fSopenharmony_ci        systemPasteboard.hasPasteData((err, data) => {
1060bc03f14fSopenharmony_ci          if (err) {
1061bc03f14fSopenharmony_ci            console.error('f_test22: systemPasteboard.hasPasteData callback error:' + err);
1062bc03f14fSopenharmony_ci            return;
1063bc03f14fSopenharmony_ci          }
1064bc03f14fSopenharmony_ci          expect(data).assertEqual(true);
1065bc03f14fSopenharmony_ci          systemPasteboard.getPasteData(async (err, data) => {
1066bc03f14fSopenharmony_ci            if (err) {
1067bc03f14fSopenharmony_ci              console.error('f_test22: systemPasteboard.getPasteData callback error:' + err);
1068bc03f14fSopenharmony_ci              return;
1069bc03f14fSopenharmony_ci            }
1070bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(1);
1071bc03f14fSopenharmony_ci            const dataRecord22 = data.getRecordAt(0);
1072bc03f14fSopenharmony_ci            const text = await dataRecord22.convertToText();
1073bc03f14fSopenharmony_ci            expect(text).assertEqual(textData22);
1074bc03f14fSopenharmony_ci            done();
1075bc03f14fSopenharmony_ci          });
1076bc03f14fSopenharmony_ci        });
1077bc03f14fSopenharmony_ci      });
1078bc03f14fSopenharmony_ci    });
1079bc03f14fSopenharmony_ci  });
1080bc03f14fSopenharmony_ci
1081bc03f14fSopenharmony_ci  /**
1082bc03f14fSopenharmony_ci   * @tc.name      pasteboard_callback_test23
1083bc03f14fSopenharmony_ci   * @tc.desc      convertToText test
1084bc03f14fSopenharmony_ci   * @tc.type      Function
1085bc03f14fSopenharmony_ci   * @tc.require   AR000H5GKU
1086bc03f14fSopenharmony_ci   */
1087bc03f14fSopenharmony_ci  it('pasteboard_callback_test23', 0, async function (done) {
1088bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
1089bc03f14fSopenharmony_ci    systemPasteboard.clear((err, data) => {
1090bc03f14fSopenharmony_ci      if (err) {
1091bc03f14fSopenharmony_ci        console.error('f_test23: systemPasteboard.clear callback error:' + err);
1092bc03f14fSopenharmony_ci        return;
1093bc03f14fSopenharmony_ci      }
1094bc03f14fSopenharmony_ci      const uriText23 = 'https://www.baidu.com/';
1095bc03f14fSopenharmony_ci      const pasteData = pasteboard.createUriData(uriText23);
1096bc03f14fSopenharmony_ci      systemPasteboard.setPasteData(pasteData, (err, data) => {
1097bc03f14fSopenharmony_ci        if (err) {
1098bc03f14fSopenharmony_ci          console.error('f_test23: systemPasteboard.setPasteData callback error:' + err);
1099bc03f14fSopenharmony_ci          return;
1100bc03f14fSopenharmony_ci        }
1101bc03f14fSopenharmony_ci        systemPasteboard.hasPasteData((err, data) => {
1102bc03f14fSopenharmony_ci          if (err) {
1103bc03f14fSopenharmony_ci            console.error('f_test23: systemPasteboard.hasPasteData callback error:' + err);
1104bc03f14fSopenharmony_ci            return;
1105bc03f14fSopenharmony_ci          }
1106bc03f14fSopenharmony_ci          expect(data).assertEqual(true);
1107bc03f14fSopenharmony_ci          systemPasteboard.getPasteData(async (err, data) => {
1108bc03f14fSopenharmony_ci            if (err) {
1109bc03f14fSopenharmony_ci              console.error('f_test23: systemPasteboard.getPasteData callback error:' + err);
1110bc03f14fSopenharmony_ci              return;
1111bc03f14fSopenharmony_ci            }
1112bc03f14fSopenharmony_ci            expect(data.getRecordCount()).assertEqual(1);
1113bc03f14fSopenharmony_ci            const dataRecord23 = data.getRecordAt(0);
1114bc03f14fSopenharmony_ci            const text = await dataRecord23.convertToText();
1115bc03f14fSopenharmony_ci            expect(text).assertEqual(uriText23);
1116bc03f14fSopenharmony_ci            done();
1117bc03f14fSopenharmony_ci          });
1118bc03f14fSopenharmony_ci        });
1119bc03f14fSopenharmony_ci      });
1120bc03f14fSopenharmony_ci    });
1121bc03f14fSopenharmony_ci  });
1122bc03f14fSopenharmony_ci
1123bc03f14fSopenharmony_ci  /**
1124bc03f14fSopenharmony_ci   *  The callback function is used for pasteboard content changes
1125bc03f14fSopenharmony_ci   */
1126bc03f14fSopenharmony_ci  function contentChanges() {
1127bc03f14fSopenharmony_ci    console.info('#EVENT: The content is changed in the pasteboard');
1128bc03f14fSopenharmony_ci  }
1129bc03f14fSopenharmony_ci});
1130